package com.zte.stats.control;


import com.zte.stats.dao.IStatsStockDao;
import com.zte.stats.model.StatsRkWarehouse;
import com.zte.stats.model.StatsDeliveryCondition;
import com.zte.stats.model.StatsWarehouse;
import com.zte.stats.service.IStatsDeliveryService;
import com.zte.stats.service.IStatsStockService;
import com.zte.util.PageModel;
import com.zte.util.ResultMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/stock")

public class StatsStockAction {

    @Autowired
    private IStatsStockService iStatsStockService;

    @RequestMapping("/warehouse")
    @ResponseBody
    public ResultMessage queryWarehouseListByCondition(PageModel<StatsWarehouse<StatsRkWarehouse>> pageModel, StatsDeliveryCondition sdc) {
        PageModel<StatsWarehouse<StatsRkWarehouse>> statsWarehousePageModel = iStatsStockService.queryWarehouseList(pageModel, sdc);
        ResultMessage msg = new ResultMessage();
        msg.setStatus(200);
        msg.setFlag(true);
        msg.setMsg("查询仓库成功！");
        msg.setData(statsWarehousePageModel);
        return msg;
    }

    @RequestMapping("/rkwarehouse")
    @ResponseBody
    public ResultMessage queryRkWarehouseListByCondition(PageModel<StatsRkWarehouse> pageModel, StatsDeliveryCondition sdc) {
        ResultMessage msg = new ResultMessage();
        PageModel<StatsRkWarehouse> statsRkWarehousePageModel = iStatsStockService.queryRKWarehouseList(pageModel, sdc);
        msg.setStatus(200);
        msg.setFlag(true);
        msg.setMsg("查询仓库入库成功！");
        msg.setData(statsRkWarehousePageModel);
        return msg;
    }
}
